package com.mym.test;

import java.util.Objects;
import java.util.Scanner;

/**
 * @author miao
 * @version 1.0
 * @date 2025/4/12 14:35
 * @description
 */
public class Goods {
    private int id;
    private String name;
    private int KuCun;
    private int price;
    private String ShangJia;

    public Goods() {
    }

    public Goods(int id, String name, int kuCun, int price, String shangJia) {
        this.id = id;
        this.name = name;
        KuCun = kuCun;
        this.price = price;
        ShangJia = shangJia;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getKuCun() {
        return KuCun;
    }

    public void setKuCun(int kuCun) {
        KuCun = kuCun;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getShangJia() {
        return ShangJia;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Goods goods = (Goods) o;
        return id == goods.id && KuCun == goods.KuCun && price == goods.price && Objects.equals(name, goods.name) && Objects.equals(ShangJia, goods.ShangJia);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, KuCun, price, ShangJia);
    }

    public void setShangJia(String shangJia) {
        ShangJia = shangJia;
    }

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", KuCun=" + KuCun +
                ", price=" + price +
                ", ShangJia='" + ShangJia + '\'' +
                '}';
    }
    public int Add(){
        return getKuCun()*getPrice();
    }
    public void Xiu(){

            System.out.println("请输入你要修改的库存数量");
            int i = new Scanner(System.in).nextInt();
            setKuCun(i);
            System.out.println("getKuCun() = " + getKuCun());

    }
}
